var SCREEN_WIDTH;
var SCREEN_HEIGHT;
$(function () {

    //点击菜单缩放时，重绘echarts，按照页面分组并在外面套上try catch
    $("#menubar-fold-btn").click(function () {
        //logo调整大小
        if ($(this).prop("className").indexOf('is-active') === -1) {
            $(".avatar-lg").css({
                'width': '60px',
                'height': '60px'
            })
        } else {
            $(".avatar-lg").css({
                'width': '130px',
                'height': '130px'
            })
        }
        //首页
        try {
            var myChart1 = echarts.getInstanceByDom(document.getElementById("sales"));
            var myChart2 = echarts.getInstanceByDom(document.getElementById("city"));
            var myChart3 = echarts.getInstanceByDom(document.getElementById("platform"));
            var myChart5 = echarts.getInstanceByDom(document.getElementById("shops"));
            myChart1.resize();
            myChart2.resize();
            myChart3.resize();
            myChart5.resize();
        } catch (e) {
        }
    });

    SCREEN_WIDTH = document.documentElement.clientWidth || document.body.clientWidth;
    SCREEN_HEIGHT = document.documentElement.clientHeight || document.body.clientHeight;
    //针对小屏幕，对一些组件样式做专门处理
    if (SCREEN_WIDTH < 1900) {
        //隐藏菜单栏
        $("#menubar-fold-btn").removeClass("is-active");
        $("body").removeClass("menubar-unfold");
        $("body").addClass("menubar-fold");

        $(".avatar-lg").css({
            'width': '60px',
            'height': '60px'
        });

        $("footer.widget-footer div").removeClass("col-sm-3");
        $("footer.widget-footer div").addClass("col-sm-4");

        // $("#overviews_div footer div").removeAttr('class');
        // $("#overviews_div footer div").attr('class', "col-sm-3");

        $("#cateSelect").css({
            "width": "110%",
            "padding-right": "0px",
            "padding-left": "0px"
        });
        $("#cityTier").css({
            "width": "115%",
            "padding-right": "0px",
            "padding-left": "0px"
        });
        $("#matchCityTier").css({
            "width": "115%",
            "padding-right": "0px",
            "padding-left": "0px"
        });
        $("#matchCate").css({
            "width": "115%",
            "padding-right": "0px",
            "padding-left": "0px"
        });
    }
});